import { SelectQueryBuilder } from "typeorm";

export const setQueryBuilder = <T>(
    queryBuilder:SelectQueryBuilder<T>,
    obj:Record<string , unknown>
) => {
    // 动态对参数进行设置
    Object.keys(obj).forEach((key)=> {
        if(obj[key]){
            queryBuilder.andWhere(`${key} = :${key}` , {[key]:obj[key]})
        }
    })
    return queryBuilder
}